# -*- coding: utf-8 -*-

from django.db import models
from django.contrib.auth.models import User, UserManager

# Create your models here.
class SocialAnimal(User):
    # This field is required.
    objects = UserManager()

    # only male and female is allowed when create a user
    SEX_CHOICES = (
        (u'male', u'男'),
        (u'female', u'女'),
    )
    # the Django book now officially recommends using a foreign key with “unique=True”. 
    sex = models.CharField(max_length=8, choices=SEX_CHOICES, blank=True)

    # head protrait, 
    # TODO : we are using file system to store user's avatar
    # this need to be improved
    avatar = models.ImageField(upload_to='avatars', blank=True, null=True)

    birthday = models.DateField(blank=True, null=True)
    # describe yourself, say I'm from Mars
    description = models.CharField(max_length=500, null=True, blank=True)
    city = models.CharField(max_length=100, null=True, blank=True)

    #TODO: now if we create a user in admin interface, the password wont be encrypted
    # we should override the default save function either in this model class or in admin.py
